//
//  XCStatusButtomView.swift
//  小陈微博Swift用纯代码创建
//
//  Created by 小陈 on 16/3/3.
//  Copyright © 2016年 小陈. All rights reserved.
//


/// 封住转发、评论、赞 到自定义的View 中
import UIKit
//import SnapKit

class XCStatusButtomView: UIView {


    
    override init(frame: CGRect) {
        super.init(frame: frame)
        // 设置控件
     prepareUI()
    }
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
//
//    private func prepareUI() {
//        // 添加子控件
//        addSubview(forwardButton)
//        addSubview(commentButton)
//        addSubview(likeButton)
//        addSubview(separatorViewFirst)
//        addSubview(separatorViewSecond)
//        
//        // 添加约束
//        // 按钮平铺
//        let multipliedBy = 1 / 3.0
//        // 转发
//        forwardButton.snp_makeConstraints { (make) -> Void in
//            make.leading.top.bottom.equalTo(self)
//            make.width.equalTo(self).multipliedBy(multipliedBy)
//        }
//        
//        // 评论
//        commentButton.snp_makeConstraints { (make) -> Void in
//            make.leading.equalTo(forwardButton.snp_trailing)
//            make.top.bottom.equalTo(self)
//            make.width.equalTo(self).multipliedBy(multipliedBy)
//        }
//        
//        // 赞
//        likeButton.snp_makeConstraints { (make) -> Void in
//            make.leading.equalTo(commentButton.snp_trailing)
//            make.top.trailing.bottom.equalTo(self)
//            make.width.equalTo(self).multipliedBy(multipliedBy)
//        }
//        
//        // 分割线1
//        separatorViewFirst.snp_makeConstraints { (make) -> Void in
//            make.centerX.equalTo(forwardButton.snp_trailing)
//            make.centerY.equalTo(forwardButton)
//        }
//        
//        // 分割线2
//        separatorViewSecond.snp_makeConstraints { (make) -> Void in
//            make.centerX.equalTo(commentButton.snp_trailing)
//            make.centerY.equalTo(commentButton)
//        }
//    }
//    
////     MARK: - 懒加载
////     转发按钮
//    private lazy var forwardButton: UIButton = UIButton(imageName: "timeline_icon_retweet", bkgImageName: "timeline_card_bottom_background", title: "转发", font: 11)
//    
//    // 评论
//    private lazy var commentButton: UIButton = UIButton(imageName: "timeline_icon_comment", bkgImageName: "timeline_card_bottom_background", title: "评论")
//    
//    // 赞
//    private lazy var likeButton: UIButton = UIButton(imageName: "timeline_icon_unlike", title: "赞")
//    
//    // 分割线1
//    private lazy var separatorViewFirst: UIImageView = UIImageView(image: UIImage(named: "timeline_card_bottom_line"))
//    
//    private lazy var separatorViewSecond: UIImageView = UIImageView(image: UIImage(named: "timeline_card_bottom_line"))
    

    func prepareUI(){
        // 添加控件
               addSubview(retweet)
               addSubview(comment)
                addSubview(unlike)
                addSubview(BgImageViewFrist)
                addSubview(bgImageViewSecond)
        // 添加约束
        
        let multipliedBy = 1 / 3.0
    /// 转发
        retweet.snp_makeConstraints { (make) -> Void in
            make.leading.bottom.top.equalTo(self)
            make.width.equalTo(self).multipliedBy(multipliedBy)
        }
        /// 评论
        comment.snp_makeConstraints { (make) -> Void in
            make.leading.equalTo(retweet.snp_trailing)
            make.top.bottom.equalTo(retweet)
            make.width.equalTo(self).multipliedBy(multipliedBy)
        }
         /// 赞
        unlike.snp_makeConstraints { (make) -> Void in
            make.leading.equalTo(comment.snp_trailing)
            make.top.bottom.equalTo(comment)
            make.trailing.equalTo(self)
            make.width.equalTo(self).multipliedBy(multipliedBy)
        }
        
        BgImageViewFrist.snp_makeConstraints { (make) -> Void in
            make.centerX.equalTo(retweet.snp_trailing)
            make.centerY.equalTo(retweet)

        }
        bgImageViewSecond.snp_makeConstraints { (make) -> Void in
            make.centerX.equalTo(comment.snp_trailing)
            make.centerY.equalTo(comment)

        }
        
    }
    
    // 转发
    lazy var retweet: UIButton = UIButton(ImageName: "timeline_icon_retweet", title:" 转发", font: 11)
    //    /// 评论
    lazy var comment: UIButton = UIButton(ImageName: "timeline_icon_comment", title: "评论", font: 11)
    /// 赞
    lazy var unlike: UIButton = UIButton(ImageName: "timeline_icon_unlike", title: "赞", font: 11)
    /// 第一个分界线
    lazy var BgImageViewFrist:UIImageView = UIImageView(image: UIImage(named: "timeline_card_bottom_line"))
    /// 第二个分界线
    lazy var bgImageViewSecond:UIImageView = UIImageView(image: UIImage(named: "timeline_card_bottom_line"))
    
    
    
    
    
//    // 转发
//    lazy var forwardButton: UIButton = UIButton(ImageName: "timeline_icon_retweet", title:" 转发", font: 11)
////    /// 评论
//    lazy var commentButton: UIButton = UIButton(ImageName: "timeline_icon_comment", title: "评论", font: 11)
//    /// 赞
//    lazy var likeButton: UIButton = UIButton(ImageName: "timeline_icon_unlike", title: "赞", font: 11)
//    /// 第一个分界线
//    lazy var separatorViewFirst:UIImageView = UIImageView(image: UIImage(named: "timeline_card_bottom_line"))
//    /// 第二个分界线
//    lazy var separatorViewSecond:UIImageView = UIImageView(image: UIImage(named: "timeline_card_bottom_line"))
//    
    
}
